package com.github.codemperor.core.token.context;

import com.github.codemperor.core.token.CurrentUserInfo;

/**
 * @author codemperor
 * @description 当前登录人的信息
 */
public class CurrentUserContext {

    private static final ThreadLocal<CurrentUserInfo> CURRENT_USER_CONTEXT = new ThreadLocal<>();

    public static void set(CurrentUserInfo user) { // 这里应该存放json字符串
        CURRENT_USER_CONTEXT.set(user);
    }

    public static CurrentUserInfo get() {
        return CURRENT_USER_CONTEXT.get();
    }

    public static void remove() {
        CURRENT_USER_CONTEXT.remove();
    }
}
